import React,{PureComponent,createRef} from 'react'
class App extends PureComponent{
  // constructor(props){
  //   super(props)
  //   this.inputRef=createRef()
  // }
  state={
    inputRef:createRef()
  }
  componentDidMount(){
    this.state.inputRef.current.focus()
    // this.inputRef.current.focus()
  }
  render(){
    return(
      <React.Fragment>
        <input type="text" ref={this.state.inputRef}></input>
        {/* <input type="text" ref={this.inputRef}></input> */}
      </React.Fragment>
    )
  }
}
export default App